package com.ternnetwork.core.controller.org;


import java.util.List;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.ternnetwork.commons.model.http.BaseResponse;
import com.ternnetwork.core.entity.org.Organization;
import com.ternnetwork.core.service.org.OrganizationService;
import com.ternnetwork.core.ui.OrganizationZtree;





@Controller
@RequestMapping("/core/org/*")
public class OrganizationController {
	
	@Resource
	private OrganizationService organizationService;
	
	@RequestMapping("manage.htm")
	public ModelAndView manage(){
		return new ModelAndView("/WEB-INF/view/core/org/organization_manage.jsp");
	}
	
	
	@RequestMapping("add.htm")
	public @ResponseBody BaseResponse add(Organization t){
		return organizationService.idoAdd(t);
	}
	
	@RequestMapping("update.htm")
	public @ResponseBody BaseResponse update(Organization t){
		return organizationService.idoUpdate(t);
	}
	
	@RequestMapping("delete.htm")
	public @ResponseBody BaseResponse delete(Long id){
	   return organizationService.idoDelete(id);
	}
	
	@RequestMapping("getZTreeJSON.htm")
	public @ResponseBody List<OrganizationZtree> getZTreeJSON(){
		return organizationService.getZTreeJSON();
	}


}
